// 表格的高度适配
// tableRef:表格实例 /tableParentRef：表格父节点的实例 /tableFooterRef 如果有底部 底部实例 fit：高度适配方式 / tableHeight 表格高度
export function tableHeightFit(tableRef: any, tableParentRef: any, tableFooterRef: any | undefined, fit = 'auto', tableHeight: any,) {
    var getTableHeight = () => {
        let clientY = document.body.clientHeight
        if (tableParentRef) {
            let tableHeight = clientY - tableParentRef.getBoundingClientRect().top - 11
            tableParentRef.style.height = tableHeight + 'px'
        }
    }
    if (tableParentRef && fit === "full") {
        setInterval(getTableHeight, 10)
    } else if (fit === "auto") {
        if (tableHeight === "auto") {
            if (tableFooterRef) tableFooterRef.value.style.position = "static"
        } else {
            tableParentRef.style.height = typeof tableHeight === "number" ? tableHeight + "px" : tableHeight
        }
    }

}
// const tableFit = () => {
//     let tableRef: any = jxtechBaseTableWrapperRef.value
//     if (tableRef && props.fit === "full") {
//         fitTableHieght()
//     } else if (props.fit === "auto") {
//         console.log(props.tableHeight)
//         if (props.tableHeight === "auto") {
//             if (jxtechTableFooterRef.value) jxtechTableFooterRef.value.style.position = "static"
//         } else {
//             tableRef.style.height = typeof props.tableHeight === "number" ? props.tableHeight + "px" : props.tableHeight
//         }
//     }

// }
// const getTableHeight = () => {
//     let clientY = document.body.clientHeight
//     let tableRef: any = jxtechBaseTableWrapperRef.value

//     if (tableRef) {
//         let tableHeight = clientY - tableRef.getBoundingClientRect().top - 11
//         tableRef.style.height = tableHeight + 'px'
//     }
// }
// let tableResizenterval: NodeJS.Timer | null = null
// const fitTableHieght = () => {
//     tableResizenterval = setInterval(getTableHeight, 10)
// }
// const resizeListener = () => {
//     window.addEventListener('resize', fitTableHieght)
// }